package model.entities;

/**
 * 
 * @author ben
 *
 */
public enum Direction {
	
	TOP,
	TOP_RIGHT,
	RIGHT,
	BOTTOM_RIGHT,
	BOTTOM,
	BOTTOM_LEFT,
	LEFT,
	TOP_LEFT;
	
	public Direction invert() {
		
		switch (this) {
		
		case TOP : return BOTTOM;
		case TOP_RIGHT : return BOTTOM_LEFT;
		case RIGHT : return LEFT;
		case BOTTOM_RIGHT : return TOP_LEFT;
		case BOTTOM : return TOP;
		case BOTTOM_LEFT : return TOP_RIGHT;
		case LEFT : return RIGHT;
		case TOP_LEFT : return BOTTOM_RIGHT;
		default : return null; // unreachable code!
		
		}
	}
	
	public Direction increment() {
		switch (this) {
		
		case TOP : return TOP_RIGHT;
		case TOP_RIGHT : return RIGHT;
		case RIGHT : return BOTTOM_RIGHT;
		case BOTTOM_RIGHT : return BOTTOM;
		case BOTTOM : return BOTTOM_LEFT;
		case BOTTOM_LEFT : return LEFT;
		case LEFT : return TOP_LEFT;
		case TOP_LEFT : return TOP;
		default : return null; // unreachable code!
		
		}
	}
	
	public Direction decrement() {
		switch (this) {
		
		case TOP : return TOP_LEFT;
		case TOP_RIGHT : return TOP;
		case RIGHT : return TOP_RIGHT;
		case BOTTOM_RIGHT : return RIGHT;
		case BOTTOM : return BOTTOM_RIGHT;
		case BOTTOM_LEFT : return BOTTOM;
		case LEFT : return BOTTOM_LEFT;
		case TOP_LEFT : return LEFT;
		default : return null; // unreachable code!
		
		}
	}
	
}
